package com.wwwarehouse.usercenter.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.Button;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.wwwarehouse.common.activity.base.BaseActivity;
import com.wwwarehouse.common.custom_widget.X5WebView;
import com.wwwarehouse.usercenter.R;
import com.wwwarehouse.usercenter.constant.UserCenterConstant;

import de.greenrobot.event.EventBus;

/**
 * 系统服务条款
 * Created by xiaoke.ni on 2017/7/11.
 */
@Route(path = UserCenterConstant.PATH_SYSTEM_SERVICE_ACTIVITY)
public class SystemServiceActivity extends BaseActivity implements View.OnClickListener {
    private Button mButton;
    private X5WebView mWebView;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_system_serice);
        assignViews();
        initData();
    }

    private void assignViews() {
        mButton = findView(R.id.button);
        mWebView = findView(R.id.tencent_webview);
        mWebView.setContentTitle(false);
        mButton.setOnClickListener(this);
    }

    private void initData() {
        mWebView.setTitle(R.string.system_service_protocol);
        mButton.setText(R.string.agree_system_service_protocol);
        mWebView.loadUrl("http://w3p.wwwarehouse.com/app/protocol/");
    }

    @Override
    public void onClick(View v) {
        if (v == mButton) {
            sp.putBooleanValue("isServiceContract", true);
            EventBus.getDefault().post("SystemServiceActivity");
            finish();
        }
    }

}
